package com.bfsoft.springbootinit.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bfsoft.springbootinit.pojo.dto.IdDTO;
import com.bfsoft.springbootinit.pojo.dto.sysrole.RoleDetailDTO;
import com.bfsoft.springbootinit.pojo.dto.sysrole.RolePageDTO;
import com.bfsoft.springbootinit.pojo.vo.ResultVO;
import com.bfsoft.springbootinit.pojo.vo.sysrole.RoleVO;
import com.bfsoft.springbootinit.service.ISysRoleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * (角色表)SYS_ROLE 前端控制器
 * </p>
 *
 * @author xxx
 * @since 2024-10-18
 */
@RestController
@RequestMapping ( "/sys-role" )
@Tag ( name = "角色管理", description = "角色管理" )
public class SysRoleController {

	@Resource
	private ISysRoleService sysRoleService;

	@PostMapping ( "/getRolePage" )
	@Operation ( summary = "获取角色列表", description = "获取角色列表" )
	public ResultVO < Page < RoleVO > > getRolePage ( @RequestBody RolePageDTO dto ) {
		return sysRoleService.getRolePage ( dto );
	}

	@PostMapping ( "/saveOrUpdateRole" )
	@Operation ( summary = "保存或修改角色", description = "保存或修改角色" )
	public ResultVO < Object > saveOrUpdateRole ( @RequestBody RoleDetailDTO dto ) {
		return sysRoleService.saveOrUpdateRole ( dto );
	}

	@PostMapping ( "/getDetailRole" )
	@Operation ( summary = "获取角色详情", description = "获取角色详情" )
	public ResultVO < RoleDetailDTO > getDetailRole ( @RequestBody IdDTO dto ) {
		return sysRoleService.getDetailRole ( dto );
	}

	@PostMapping ( "/deleteRole" )
	@Operation ( summary = "删除角色", description = "删除角色" )
	public ResultVO < Object > deleteRole ( @RequestBody IdDTO dto ) {
		return sysRoleService.deleteRole ( dto );
	}

}
